﻿using System;
using System.Windows;

namespace ButsaForecast.Dialogs
{
	/// <summary>
	/// Interaction logic for MessageDialog.xaml
	/// </summary>
	public partial class MessageDialog : Window
	{
		public MessageDialog(string message)
		{
			InitializeComponent();

			LogMessage(message);
		}

		private void LogMessage(string message)
		{
			if (LogTextBox.Dispatcher.CheckAccess())
			{
				LogTextBox.Text = message + "\r\n" + LogTextBox.Text;
			}
			else
			{
				LogTextBox.Dispatcher.Invoke(new Action(() => LogMessage(message)), new object[] { });
			}
		}
	}
}
